import Vue from 'vue'
import App from './App.vue'
import './assets/global.css'
import router from './router'
import './assets/fonts/iconfont.css'
import './plugins/element.js'
import './assets/dealtime.js'
import 'element-ui/lib/theme-chalk/index.css'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import axios from 'axios'
import ElementUI from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// 全局使用element-ui
Vue.use(ElementUI)
Vue.use(VueQuillEditor)
Vue.config.productionTip = false
Vue.prototype.$http = axios
// 设置基准地址
axios.defaults.baseURL = 'http://www.klxin.cn:8888/api/private/v1/'

// 设置请求拦截器
axios.interceptors.request.use((res) => {
  NProgress.start()
  // 将token放到Authorization当中
  res.headers.Authorization = window.sessionStorage.getItem('token')
  return res
})

// 设置响应拦截器
axios.interceptors.response.use((res) => {
  NProgress.done()

  return res.data
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
